<template lang="">
  <div class="_wrapper">
    <template v-if="comComponent">
      <component :is="comComponent" ref="cusComponent" />
    </template>
  </div>
</template>
<script>
import FactoryComponent from "@/views/ai/factory-component.js";
import { markRaw } from "vue";
export default {
  data() {
    return {
      code: this.$route.query.code,
      comComponent: undefined,
    };
  },
  mounted() {
    this.code = this.$route.query.code;
    if (this.code) {
      return FactoryComponent[this.code]().then((res) => {
        this.comComponent = markRaw(res.default);
      });
    }
    console.log("找不到该插件信息 - ", this.code);

    FactoryComponent["com-empty"].then(
      (res) => (this.comComponent = res.default)
    );
  },
};
</script>
<style scoped></style>
